package com.lantosec.hmrp.modules.form.enumeration;

/**
 * 自定义表单表列值类型
 */
public enum ColumnValueTypeEnum {
    DEFAULT("DEFAULT", "默认值"),
    SQL("SQL", "SQL查询值"),
    SQL_LIST("SQL_LIST", "SQL LIST查询列表"),
    DICTIONARIES("DICTIONARIES", "字典"),
    JAVASCRIPT_MATH("JAVASCRIPT_MATH", "js公式"),
    JAVA_MATH("JAVA_MATH", "java公式"),

    SQL_MAP_LIST("SQL_MAP_LIST", "SQL MAP LIST查询列表"),
    UPDATE_SQL("UPDATE_SQL", "SQL更新");

    private String type;
    private String name;

    private ColumnValueTypeEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static ColumnValueTypeEnum getByType(String type) {
        for (ColumnValueTypeEnum item : ColumnValueTypeEnum.values()) {
            if (item.getType().equals(type)) {
                return item;
            }
        }
        return ColumnValueTypeEnum.DEFAULT;
    }

}
